#include <X11/Xatom.h>
+#ifdef HAVE_XFREE_XINERAMA
+#include <X11/extensions/Xinerama.h>
+#endif
+
#ifdef HAVE_RANDR
#include <X11/extensions/Xrandr.h>
#endif
gint bottom_most_pos = 0;
gint right_most_pos = 0;
gint i;
+#ifdef HAVE_XFREE_XINERAMA
+ XineramaScreenInfo *x_monitors;
+ int x_n_monitors;
+#endif
+
+ *top = *bottom = *left = *right = -1;
+
+#ifdef HAVE_XFREE_XINERAMA
+ if (!XineramaIsActive (x11_screen->xdisplay))
+ return;
- for (i = 0; i < x11_screen->monitors->len; i++)
+ x_monitors = XineramaQueryScreens (x11_screen->xdisplay, &x_n_monitors);
+ if (x_n_monitors <= 0 || x_monitors == NULL)
{
- GdkMonitor *monitor = x11_screen->monitors->pdata[i];
- GdkRectangle geometry;
+ if (x_monitors)
+ XFree (x_monitors);
- gdk_monitor_get_geometry (monitor, &geometry);
+ return;
+ }
- if (left && left_most_pos > geometry.x)
+ for (i = 0; i < x_n_monitors; i++)
+ {
+ if (left && left_most_pos > x_monitors[i].x_org)
{
- left_most_pos = geometry.x;
+ left_most_pos = x_monitors[i].x_org;
*left = i;
}
- if (right && right_most_pos < geometry.x + geometry.width)
+ if (right && right_most_pos < x_monitors[i].x_org + x_monitors[i].width)
{
- right_most_pos = geometry.x + geometry.width;
+ right_most_pos = x_monitors[i].x_org + x_monitors[i].width;
*right = i;
}
- if (top && top_most_pos > geometry.y)
+ if (top && top_most_pos > x_monitors[i].y_org)
{
- top_most_pos = geometry.y;
+ top_most_pos = x_monitors[i].y_org;
*top = i;
}
- if (bottom && bottom_most_pos < geometry.y + geometry.height)
+ if (bottom && bottom_most_pos < x_monitors[i].y_org + x_monitors[i].height)
{
- bottom_most_pos = geometry.y + geometry.height;
+ bottom_most_pos = x_monitors[i].y_org + x_monitors[i].height;
*bottom = i;
}
}
+
+ XFree (x_monitors);
+#endif
}
void
if (GDK_WINDOW_IS_MAPPED (window))
{
XClientMessageEvent xclient;
- gint gdk_monitors[4];
+ gint monitors[4];
gint i;
memset (&xclient, 0, sizeof (xclient));
case GDK_FULLSCREEN_ON_ALL_MONITORS:
_gdk_x11_screen_get_edge_monitors (GDK_WINDOW_SCREEN (window),
- &gdk_monitors[0],
- &gdk_monitors[1],
- &gdk_monitors[2],
- &gdk_monitors[3]);
+ &monitors[0],
+ &monitors[1],
+ &monitors[2],
+ &monitors[3]);
/* Translate all 4 monitors from the GDK set into XINERAMA indices */
for (i = 0; i < 4; ++i)
{
- /* FIXME
- xclient.data.l[i] = _gdk_x11_screen_ge_xinerama_index (GDK_WINDOW_SCREEN (window), gdk_monitors[i]); */
- xclient.data.l[i] = 0;
+ xclient.data.l[i] = monitors[i];
/* Sanity check, if XINERAMA is not available, we could have invalid
* negative values for the XINERAMA indices.
*/